-
Notifications
You must be signed in to change notification settings - Fork 1k
Remove the need to bump class version when indy advice is used #15258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| boolean allowClassVersionChange = | ||
| config.getBoolean("otel.javaagent.experimental.allow-class-version-change", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now left a flag for switching back to changing the class version, if there is no interest in keeping it could remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support fewer options 😄
|
This is a very clever idea, simpler and less risky than trying to update bytecode version on the fly. Do we have any case where injecting helper classes is not possible, for example due to a non-cooperative classloader implementation ? If no, this looks definitely safe to use this strategy by default.
I know recomputing the stack map can be costly, but I have to admit that I never actually measured it nor seen any major impact in the application startup overhead. Have you seen any significant difference with this change ? Also, do you have any known example of strict class parsing causing an issue ? This is more curiosity here, but is that something we expect to happen more with current and future JVM versions ? |
We are using the same approach as we currently use for helper class injection. We insert loading the helper classes into
The question is usually not about the cost but more about whether it can be reconstructed at all. The complicated part is that given types
Have a look at https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/classFileParser.cpp and search for |
| boolean allowClassVersionChange = | ||
| config.getBoolean("otel.javaagent.experimental.allow-class-version-change", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support fewer options 😄
Instead of bumping class version to 1.7 so
invokedynamicinstruction could be used this PR introduces a more conservative approach. If class version supportsinvokedynamicwe'll add theinvokedynamicinstruction as we do now. If the class version does not supportinvokedynamicwe generate an helper class that contains theinvokedynamicinstruction in a static method and invoke that method viainvokestatic. This way we don't have to worry about jvm class file parsing being more strict for newer class versions or building the stack map etc.